<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/public/header.jsp"%>
<%
    String callback = request.getParameter("callback");
	String id = request.getParameter("id") == null ? "" : request.getParameter("id");
	Map<String, Object> sessionMap = (Map<String, Object>) session.getAttribute("LOGIN_USER");
	String person_id = String.valueOf(sessionMap.get("id"));
	String person = String.valueOf(sessionMap.get("truename"));
	boolean isAdd = "".equals(id);
    int flag = 0;
    if(!isAdd){
    	flag = 1;
    }
%>
<html>
	<head>
		<title>查看项目支付</title>
		<script type="text/javascript" src="<%=contextPath %>/public/js/extend.js"></script>
		<style>
			.td1{
				padding-top:10px;
				padding-bottom:5px;
				font-size: 12px;
				background-color: #c0ebd7;
				width:20%;
			}
			.td2{
				padding:5px;
			}
		</style>
	<script type="text/javascript">
		var lastIndex;
		var lastIndex1;
		$(function(){
				 $('#ff').form('load','<%=contextPath %>/springMVC/xmFinance/viewXmPay?id=<%=id%>');
			jQuery("#tableAdv").datagrid({
				title:"扣垫款",
				iconCls:'icon-receive',
				loadMsg:'正在加载数据，请稍后......',
				url:"<%=contextPath %>/springMVC/finance/listGdYetAdvancesByYetId?id=<%=id%>",
				rownumbers:true,
				fitColumns:true,
				nowrap:false,
				idField:'id',
				frozenColumns:[[
				      {title:'主键',field:'id',hidden:true}
				]],
				columns:[[
						{title:'工单id',field:'gd_id',hidden:true},
						{title:'工单编号',field:'gd_code',width:250,align:'center'},
						{title:'工单名称',field:'gd_name',width:150,align:'center'},
						{title:'垫款标题',field:'title',width:100,align:'center'},
						{title:'垫款金额',field:'money',width:100,align:'center'},
						{title:'结余本金',field:'now_on_money',width:100,align:'center'},
						{title:'利率',field:'rate',width:100,align:'center'},
						{title:'利息',field:'lxMoney',width:100,align:'center'},
						{title:'已还金额',field:'already_money',width:100,align:'center'},
						{title:'本次还款金额',field:'yet_money',width:100,align:'center'}
					
				]],
				onLoadSuccess:function(rtJson){
					if(rtJson.rtState== '1')
					{
						addPayValue();
						$.messager.alert('提示',rtJson.rtMsrg);
					}
				}
			});
			
			
			
	       $('#table').datagrid({
	    	  	 title:"支付",
				 iconCls:'icon-zc',
	    	   	url:"<%=contextPath%>/springMVC/finance/listXmPayWorkerDetail?id=<%=id%>",
				rownumbers:true,
				fitColumns:true,
				columns:[[
					{title:'工单id',field:'gd_id',hidden:true},
					{title:'工单编号',field:'gd_code',width:250,align:'center'},
					{title:'工单名称',field:'gd_name',width:150,align:'center'},
					{title:'预算金额',field:'budget',width:200,align:'center'},
					{title:'已付金额',field:'already_pay',width:200,align:'center',formatter:function (value,rowData,index){
						if(value==undefined){
							rowData.already_pay=0;
						}
						return rowData.already_pay=rowData.already_pay;
					}},
					{title:'现付款',field:'now_pay',width:100,align:'center'},
					{title:'备注',field:'remark',width:200,align:'center'}
				]],
				onLoadSuccess:function(rtJson){
					if(rtJson.rtState== '1')
					{
						addPayValue();
						$.messager.alert('提示',rtJson.rtMsrg);
					}
				}
			});
			
		});
		
	</script>
	</head>
	<body>
		<div style="width: 97%;padding-left:10px">
		<form id="ff">
		<input  type="hidden" id="pay_to_id" name="pay_to_id" >
		<input  type="hidden" id="pay_to_name" name="pay_to_name" >
			<table  style="border-collapse: collapse;" width="100%" border="1px" bordercolor="#0eb83a">
				<tr>
					<td align="right" class="td1" nowrap>项目编号：</td>
					<td class="td2" nowrap>
						<input  id="xm_code" name="xm_code" readOnly   placeholder="项目验收后停止进度付款">
						<input type="hidden" id="xm_id" name="xm_id" readOnly >
	
					</td>
					<td align="right" class="td1" nowrap>项目名称：</td>
					<td class="td2" nowrap>
						<input  id="xm_name" name="xm_name" readOnly   placeholder="项目验收后停止进度付款">
					</td>
				</tr>
				<tr>
					<td align="right" class="td1" nowrap>项目部门：</td>
					<td class="td2" nowrap>
						<input  id="dept_name" name="dept_name" readOnly value="">
						<input  type="hidden" id="dept_id" name="dept_id" readOnly value="">
					</td>
					<td align="right" class="td1" nowrap>经办人：</td>
					<td class="td2" nowrap>
						<input  id="creator" name="creator" readOnly  >
					</td>
				</tr>
				<tr>
					<td align="right" class="td1" nowrap>对应客户：</td>
					<td class="td2" nowrap  >
						<input  id="customer" name="customer" readOnly value="">
						<input  type="hidden" id="customer_id" name="customer_id" readOnly value="">
					</td>
			      <td align="right" class="td1" nowrap>选择施工队：</td>
					<td class="td2" nowrap  >
						<input  id="pay_to_name" name="pay_to_name" >
					</td>	
				</tr>
			
				<tr>	
			        <td align="right" class="td1" nowrap>到款金额：</td>
					<td class="td2" nowrap  >
						<input  id="has_receivable" name="has_receivable" class="easyui-numberbox" readonly="readonly" data-options="min:0,precision:2" value="0">
					</td>
	
			       
			        <td align="right" class="td1" nowrap>付款金额：</td>
					<td class="td2" nowrap  >
						<input  id="pay_value" name="pay_value" class="easyui-numberbox" readonly="readonly" data-options="min:0,precision:2" value="0">(自动计算)
					</td>
	
			       
				</tr>				
				<tr>
					<td align="right" class="td1" nowrap>摘要：</td>
					<td class="td2" nowrap colspan='3'>
						<textarea  id="remark" name="remark" rows="6" style="width: 100%"></textarea>
					</td>
				</tr>
				<tr>
					<td colspan="4"  nowrap>
						<div id="tableAdv"></div>
					</td>
				</tr>
				<tr>
					<td colspan="4"  nowrap>
						<div id="table"></div>
					</td>
				</tr>
			</table>
			</form>
		</div>
		
	</body>
</html>